Last updated by: Manasa, Last updated on: 23/09/2024
Penetration Test of MQTT Server
Introduction
The key concepts of penetration testing and MQTT (Message Queuing Telemetry Transport) are essential in the realms of cybersecurity and real-time messaging. Penetration testing plays an important role in identifying system vulnerabilities and enhancing defenses against potential threats. On the other hand, MQTT is widely used in IoT and messaging applications to facilitate communication between clients. Tools such as Nmap, which is used for network scanning, and Wireshark, for packet analysis, are vital in assessing and ensuring the security and efficiency of these operations.
Penetration Test on redback.it.deakin.edu.au MQTT Server:
Nmap to Scan redback.it.deakin.edu.au (ip address 10.137.0149)
- nmap to check whether the host (redback.it.deakin.edu.au with IP 10.137.0.149) is online and responding to network requests. The output indicates that the host is up with a latency of 0.032 seconds.
ping 10.137.0.149
Purpose:
- Check Host Availability: The ping command was used to verify whether the host at IP address 10.137.0.149 is reachable and responsive over the network. By sending ICMP (Internet Control Message Protocol) Echo Request packets, the command measures the time it takes for the host to respond, confirming its availability.
- The ping test confirms that the host at 10.137.0.149 is up and responding with minimal latency and no packet loss, making it reachable for further communication or scanning tasks.
Opening the website: We can see a file upload page on the site.
Full Port Scan of 10.137.0.149
Purpose:
- Comprehensive Port Scan: The -p- flag tells Nmap to scan all 65,535 TCP ports on the target host (10.137.0.149). This command ensures that no port is missed, providing a full overview of which ports are open, closed, or filtered.
- SYN Stealth Scan: Nmap uses a SYN Stealth Scan by default when running with sudo privileges. This scan sends SYN packets and waits for responses to identify open ports, without completing the TCP connection. This is a faster and stealthier method of scanning compared to a full TCP connection scan.
Key Details from the Output:
-
Host Status: The host 10.137.0.149 is up with a very low latency of 0.00091s, indicating a fast response from the host.
-
Filtered and Closed Ports:
- 65,020 filtered ports: These ports did not respond to the scan, likely due to firewall rules or packet filtering.
- 492 closed ports: These ports responded with a TCP reset, meaning no service is running on these ports.
-
Open Ports and Services: The scan found several open ports with services running on them, including:
- 22/tcp: SSH (Secure Shell)
- 25/tcp: SMTP (Simple Mail Transfer Protocol)
- 80/tcp: HTTP (HyperText Transfer Protocol)
- 443/tcp: HTTPS (HTTP Secure)
- 1514/tcp: Fujitsu DTCNS
- 1883/tcp: MQTT (Message Queuing Telemetry Transport)
- 5000/tcp: UPnP (Universal Plug and Play)
- 5001/tcp: Commplex-link
- 8000/tcp: HTTP-alt (Alternative HTTP Port)
- 8080/tcp: HTTP Proxy
- 8888/tcp: Sun Answerbook
- 9000/tcp: CSListener
- 9001/tcp: Tor ORPort (used for Tor network)
- 27017/tcp: MongoDB (default port for MongoDB database)
- 50000/tcp: IBM DB2 database
- Several other open ports with unknown services, such as 9047, 19120, 31010, 32010, and 55000.
-
Port 8883/tcp: The port is filtered, meaning that network devices (such as firewalls) are blocking direct communication on this port. This suggests that secure MQTT (MQTT over TLS/SSL) is not currently accessible.
Operating System of the Host
- Based on the Nmap scan results, it appears that the host (IP address 10.137.0.149) is most likely running in a virtualized environment. The OS guess provided by Nmap suggests that it is either running Oracle VirtualBox (95%)or QEMU (91%) as the virtualization software. However, the exact operating system could not be identified due to insufficient open and closed port data.This means the system could be running on a guest operating system inside one of these virtual environments.
Nmap Command to Scan MQTT Ports (1883, 8883) on 10.137.0.149
Key Details from the Output:
- -p specifies which port or ports to scan. In this case, you are telling Nmap to scan ports 1883 and 8883 only, which are the default ports for the MQTT protocol.
- Host Status: The host 10.137.0.149 is up, with a latency of 0.015 seconds, indicating a quick response from the host.
- Port 1883/tcp: This port is open, indicating that the MQTT service is accessible on this port for unencrypted communication.
Service Version Detection Scan on Port 1883
Explanation:
- Service Version Detection (-sV): The -sV option in Nmap tells it to not only check if the port is open but also to attempt to detect the version of the service running on the specified port.
- Port-Specific Scan (-p 1883): The scan is focused specifically on port 1883, which is the default port for MQTT services.
- Port 1883 is open: Port 1883 is open, meaning the MQTT service is accessible on this
- Service: Nmap detected that the service running on port 1883 is Mosquitto, which is a popular MQTT broker.
- Version: The version of the Mosquitto broker is 1.6.9, providing detailed information about the service.
Nmap Vulnerability Scan on port 1883 10.137.0.149
- Vulnerability Scan (--script vuln): The --script vuln option in Nmap tells it to run a set of scripts that detect common vulnerabilities on the target host. This includes potential issues with various services running on the host.
- port 1883 (MQTT) was scanned, no vulnerabilities were detected specifically for the MQTT service running on that port. The scan focused on detecting commonly known vulnerabilities across all the open ports but did not flag any issues with the MQTT service on port 1883.
Aggressive Scanning on Port 1883 Script Detection
- Advanced Scan (-A): The -A option in Nmap enables aggressive scanning, which includes OS Detection, Service Version Detection, Script Scanning and Traceroute.
- Host Status: The host 10.137.0.149 is up, with low latency of 0.010 seconds.
- Port 1883 (MQTT) Service: The service running on port 1883 is identified as Mosquitto MQTT broker, version 1.6.9.
- Script Output - mqtt-subscribe: The script gathered real-time information from the broker’s system topics ($SYS/ topics) that provide internal metrics of the broker.
Mosquitto and Mosquitto Clients Installation
- The mosquitto -h command provides an overview of the available options for starting and configuring the Mosquitto MQTT broker. We can use these options to customize the broker's behavior, such as setting a config file, changing the port, or running it in the background.
Output with mqtt-subscribe Script
Purpose:
This command scanned the MQTT broker running on port 1883 of the target host 10.137.0.149 and used the mqtt-subscribe script to gather real-time system information by subscribing to MQTT topics, including the $SYS topics, which provide internal broker metrics.